<?php
/**
 * Created by PhpStorm.
 * User: root
 * Date: 8/5/14
 * Time: 1:30 PM
 */

namespace UploadFile\Mapper;
use Base\Mapper\AbstractDbMapper;
use Zend\Stdlib\Hydrator\HydratorInterface as Hydrator;

class UploadFileMapper extends AbstractDbMapper
{
    protected $tableName  = 'images';

    public function insert($entity, $tableName = null, Hydrator $hydrator = null)
    {
        $hydrator = $hydrator ?: $this->getHydrator();
        $result = parent::insert($entity, $tableName, $hydrator);
        $hydrator->hydrate(array('image_id' => $result->getGeneratedValue()), $entity);
        return $result;
    }

    public function getTableName()
    {
        return $this->tableName;
    }

    public function setTableName($tableName)
    {
        $this->tableName=$tableName;
    }
} 